<!-- File: /app/View/Especialidades/index.ctp -->

<?php
    $this->Html->script("tablesorter/jquery.tablesorter", array('inline' => false));
    $this->Html->script("tablesorter/tables", array('inline' => false));
?>

<?php 
    $this->html->addCrumb(
        $this->Html->tag("i", "", array("class" => "fa fa-file")) . " Especialidades",
        '/Especialidades',
        array("escape" => false)
    );
?>

<h1>Especialidad<small> Muestra la lista de especialidades</small></h1>


<?php echo $this->Html->link(
    $this->Html->tag("span", "", array("class" => "glyphicon glyphicon-plus")) .
    " Agregar Especialidad",
    array("controller" => "Admin", "action" => "Especialidades", "add"),
    array("class" => "btn btn-default", "role" => "button", "escape" => false)
); ?>

<div class="table-responsive">
    <table class="table table-bordered table-hover table-striped tablesorter">
        <thead>
            <tr>
                <th>Id <i class="fa fa-sort"></i></th>
                <th>Descripción <i class="fa fa-sort"></i></th>
                <th>Campo de Acción <i class="fa fa-sort"></i></th>
                <th>Acciones <i class="fa fa-sort"></i></th>
            </tr>
        </thead>
        <tbody>
            <?php foreach ($especialidades as $especialidad) { ?>
            <tr>
                <td><?php echo $especialidad["Especialidad"]["id"]; ?></td>
                <td>
                    <?php echo $this->Html->link($especialidad["Especialidad"]["descripcion"],
                    array("controller" => "Admin", "action" => "Especialidades", "view", $especialidad["Especialidad"]["id"])); ?>
                </td>
                <td><?php echo $especialidad["Campo"]["descripcion"]; ?></td>
                <td>
                    <div class="btn-group">
                        <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                            <span class="glyphicon glyphicon-chevron-down"></span> Acción 
                            <span class="caret"></span>
                        </button>
                        <ul class="dropdown-menu" role="menu">
                            <li>
                                <?php
                                    echo $this->Html->link(
                                        $this->Html->tag("span", "", array("class" => "glyphicon glyphicon-edit")) .
                                        " Editar",
                                        array("controller" => "Admin", "action" => "Especialidades", "edit", $especialidad["Especialidad"]["id"]),
                                        array("escape" => false)
                                    );
                                ?>
                            </li>
                            <li>
                                <?php
                                    echo $this->Form->postLink(
                                        $this->Html->tag("span", "", array("class" => "glyphicon glyphicon-remove")) .
                                        " Eliminar",
                                        array("action" => "delete", $especialidad["Especialidad"]["id"]),
                                        array("confirm" => "¿Estás seguro?", "escape" => false)
                                    );
                                ?>
                            </li>
                        </ul>
                    </div>
                </td>
            </tr>
            <?php } ?>
            <?php unset($especialidad); ?>
        </tbody>
    </table>
</div>